﻿using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;

namespace Chenxin.Lib.Business.DAL
{
    /// <summary>
    /// 数据访问类t_Preliminary_SubInfo3。
    /// </summary>
    public class t_Preliminary_SubInfo3
    {
        public t_Preliminary_SubInfo3()
        { }
        #region 成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public static bool Exists(Guid RecordId)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from t_Preliminary_SubInfo3 where RecordId=@RecordId ");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, RecordId);
            int cmdresult;
            object obj = db.ExecuteScalar(dbCommand);
            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            if (cmdresult == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static void Add(Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into t_Preliminary_SubInfo3(");
            strSql.Append("RecordId,MainId,EmpCityId,EmpCompanyId,EmpDepartId,EmployeeId,OperateCompanyId,OperateDepartId,OperateUserId,ContractId,LoanCode,LoanInfo,LoanDealMode,ContractCode,EvaluateCorp,InsuranceCorp,LackInfo,ReceiveBank,LoanXfYear,LoanSxYear,LoanZyYear,SalerPhone,BuyerPhone,CustomerName,IDNum,GJJyear,SYYear,OrderPlace,SaleName,SaleIDCard,OldLoanBank,EmpCityName,EmpCompanyName,EmpDepartName,EmployeeName,EmpPhone,OperateCompanyName,OperateDepartName,OperateUserName,Address,Remark,SLRemark,SHRemark,FKRemark,SalePrice_T,EvaluateFee,InsuranceFee,AgencyFee,OutVouchFee,VouchFee,LoanXf,LoanSx,LoanZy,BankQueryFee,BankManageFee,LoanBankSaleComplete,EstimatePrice,GJJmoney,SYMoney,OldLoanMoney,OldRestMoney,TJMoney,BuildingArea,LoanContractDate,MortgageClearDate,LoanComplete,BankLoanDate,ReceiveLoanDate,SendToBankDate,VoucherToBankDate,CertificateDate,BankCompleteDate,SLDate,SHDate,FKDate,UpSLDate,UpSHDate,UpFKDate,EvaluateFeeDate,VouchFeeDate,InsuranceFeeDate,AgencyFeeDate,OutVouchFeeDate,EndDate,EstimReportBackDate,CompleteLoanDate,TJDate,IsNoEvaluateFee,IdBankReceipt,IdZhuanBen,IsNoAgencyFee,IdShouBen,IsLack,Receipt,Mortgage,Status,CompleteYear,Total_Floor,TJPercent)");

            strSql.Append(" values (");
            strSql.Append("@RecordId,@MainId,@EmpCityId,@EmpCompanyId,@EmpDepartId,@EmployeeId,@OperateCompanyId,@OperateDepartId,@OperateUserId,@ContractId,@LoanCode,@LoanInfo,@LoanDealMode,@ContractCode,@EvaluateCorp,@InsuranceCorp,@LackInfo,@ReceiveBank,@LoanXfYear,@LoanSxYear,@LoanZyYear,@SalerPhone,@BuyerPhone,@CustomerName,@IDNum,@GJJyear,@SYYear,@OrderPlace,@SaleName,@SaleIDCard,@OldLoanBank,@EmpCityName,@EmpCompanyName,@EmpDepartName,@EmployeeName,@EmpPhone,@OperateCompanyName,@OperateDepartName,@OperateUserName,@Address,@Remark,@SLRemark,@SHRemark,@FKRemark,@SalePrice_T,@EvaluateFee,@InsuranceFee,@AgencyFee,@OutVouchFee,@VouchFee,@LoanXf,@LoanSx,@LoanZy,@BankQueryFee,@BankManageFee,@LoanBankSaleComplete,@EstimatePrice,@GJJmoney,@SYMoney,@OldLoanMoney,@OldRestMoney,@TJMoney,@BuildingArea,@LoanContractDate,@MortgageClearDate,@LoanComplete,@BankLoanDate,@ReceiveLoanDate,@SendToBankDate,@VoucherToBankDate,@CertificateDate,@BankCompleteDate,@SLDate,@SHDate,@FKDate,@UpSLDate,@UpSHDate,@UpFKDate,@EvaluateFeeDate,@VouchFeeDate,@InsuranceFeeDate,@AgencyFeeDate,@OutVouchFeeDate,@EndDate,@EstimReportBackDate,@CompleteLoanDate,@TJDate,@IsNoEvaluateFee,@IdBankReceipt,@IdZhuanBen,@IsNoAgencyFee,@IdShouBen,@IsLack,@Receipt,@Mortgage,@Status,@CompleteYear,@Total_Floor,@TJPercent)");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, model.RecordId);
            db.AddInParameter(dbCommand, "MainId", DbType.Guid, model.MainId);
            db.AddInParameter(dbCommand, "EmpCityId", DbType.Guid, model.EmpCityId);
            db.AddInParameter(dbCommand, "EmpCompanyId", DbType.Guid, model.EmpCompanyId);
            db.AddInParameter(dbCommand, "EmpDepartId", DbType.Guid, model.EmpDepartId);
            db.AddInParameter(dbCommand, "EmployeeId", DbType.Guid, model.EmployeeId);
            db.AddInParameter(dbCommand, "OperateCompanyId", DbType.Guid, model.OperateCompanyId);
            db.AddInParameter(dbCommand, "OperateDepartId", DbType.Guid, model.OperateDepartId);
            db.AddInParameter(dbCommand, "OperateUserId", DbType.Guid, model.OperateUserId);
            db.AddInParameter(dbCommand, "ContractId", DbType.Guid, model.ContractId);
            db.AddInParameter(dbCommand, "LoanCode", DbType.AnsiString, model.LoanCode);
            db.AddInParameter(dbCommand, "LoanInfo", DbType.AnsiString, model.LoanInfo);
            db.AddInParameter(dbCommand, "LoanDealMode", DbType.AnsiString, model.LoanDealMode);
            db.AddInParameter(dbCommand, "ContractCode", DbType.AnsiString, model.ContractCode);
            db.AddInParameter(dbCommand, "EvaluateCorp", DbType.AnsiString, model.EvaluateCorp);
            db.AddInParameter(dbCommand, "InsuranceCorp", DbType.AnsiString, model.InsuranceCorp);
            db.AddInParameter(dbCommand, "LackInfo", DbType.AnsiString, model.LackInfo);
            db.AddInParameter(dbCommand, "ReceiveBank", DbType.AnsiString, model.ReceiveBank);
            db.AddInParameter(dbCommand, "LoanXfYear", DbType.AnsiString, model.LoanXfYear);
            db.AddInParameter(dbCommand, "LoanSxYear", DbType.AnsiString, model.LoanSxYear);
            db.AddInParameter(dbCommand, "LoanZyYear", DbType.AnsiString, model.LoanZyYear);
            db.AddInParameter(dbCommand, "SalerPhone", DbType.AnsiString, model.SalerPhone);
            db.AddInParameter(dbCommand, "BuyerPhone", DbType.AnsiString, model.BuyerPhone);
            db.AddInParameter(dbCommand, "CustomerName", DbType.AnsiString, model.CustomerName);
            db.AddInParameter(dbCommand, "IDNum", DbType.AnsiString, model.IDNum);
            db.AddInParameter(dbCommand, "GJJyear", DbType.AnsiString, model.GJJyear);
            db.AddInParameter(dbCommand, "SYYear", DbType.AnsiString, model.SYYear);
            db.AddInParameter(dbCommand, "OrderPlace", DbType.AnsiString, model.OrderPlace);
            db.AddInParameter(dbCommand, "SaleName", DbType.AnsiString, model.SaleName);
            db.AddInParameter(dbCommand, "SaleIDCard", DbType.AnsiString, model.SaleIDCard);
            db.AddInParameter(dbCommand, "OldLoanBank", DbType.AnsiString, model.OldLoanBank);
            db.AddInParameter(dbCommand, "EmpCityName", DbType.AnsiString, model.EmpCityName);
            db.AddInParameter(dbCommand, "EmpCompanyName", DbType.AnsiString, model.EmpCompanyName);
            db.AddInParameter(dbCommand, "EmpDepartName", DbType.AnsiString, model.EmpDepartName);
            db.AddInParameter(dbCommand, "EmployeeName", DbType.AnsiString, model.EmployeeName);
            db.AddInParameter(dbCommand, "EmpPhone", DbType.AnsiString, model.EmpPhone);
            db.AddInParameter(dbCommand, "OperateCompanyName", DbType.AnsiString, model.OperateCompanyName);
            db.AddInParameter(dbCommand, "OperateDepartName", DbType.AnsiString, model.OperateDepartName);
            db.AddInParameter(dbCommand, "OperateUserName", DbType.AnsiString, model.OperateUserName);
            db.AddInParameter(dbCommand, "Address", DbType.AnsiString, model.Address);
            db.AddInParameter(dbCommand, "Remark", DbType.AnsiString, model.Remark);
            db.AddInParameter(dbCommand, "SLRemark", DbType.AnsiString, model.SLRemark);
            db.AddInParameter(dbCommand, "SHRemark", DbType.AnsiString, model.SHRemark);
            db.AddInParameter(dbCommand, "FKRemark", DbType.AnsiString, model.FKRemark);
            db.AddInParameter(dbCommand, "SalePrice_T", DbType.Decimal, model.SalePrice_T);
            db.AddInParameter(dbCommand, "EvaluateFee", DbType.Decimal, model.EvaluateFee);
            db.AddInParameter(dbCommand, "InsuranceFee", DbType.Decimal, model.InsuranceFee);
            db.AddInParameter(dbCommand, "AgencyFee", DbType.Decimal, model.AgencyFee);
            db.AddInParameter(dbCommand, "OutVouchFee", DbType.Decimal, model.OutVouchFee);
            db.AddInParameter(dbCommand, "VouchFee", DbType.Decimal, model.VouchFee);
            db.AddInParameter(dbCommand, "LoanXf", DbType.Decimal, model.LoanXf);
            db.AddInParameter(dbCommand, "LoanSx", DbType.Decimal, model.LoanSx);
            db.AddInParameter(dbCommand, "LoanZy", DbType.Decimal, model.LoanZy);
            db.AddInParameter(dbCommand, "BankQueryFee", DbType.Decimal, model.BankQueryFee);
            db.AddInParameter(dbCommand, "BankManageFee", DbType.Decimal, model.BankManageFee);
            db.AddInParameter(dbCommand, "LoanBankSaleComplete", DbType.Decimal, model.LoanBankSaleComplete);
            db.AddInParameter(dbCommand, "EstimatePrice", DbType.Decimal, model.EstimatePrice);
            db.AddInParameter(dbCommand, "GJJmoney", DbType.Decimal, model.GJJmoney);
            db.AddInParameter(dbCommand, "SYMoney", DbType.Decimal, model.SYMoney);
            db.AddInParameter(dbCommand, "OldLoanMoney", DbType.Decimal, model.OldLoanMoney);
            db.AddInParameter(dbCommand, "OldRestMoney", DbType.Decimal, model.OldRestMoney);
            db.AddInParameter(dbCommand, "TJMoney", DbType.Decimal, model.TJMoney);
            db.AddInParameter(dbCommand, "BuildingArea", DbType.Decimal, model.BuildingArea);
            db.AddInParameter(dbCommand, "LoanContractDate", DbType.DateTime, model.LoanContractDate);
            db.AddInParameter(dbCommand, "MortgageClearDate", DbType.DateTime, model.MortgageClearDate);
            db.AddInParameter(dbCommand, "LoanComplete", DbType.DateTime, model.LoanComplete);
            db.AddInParameter(dbCommand, "BankLoanDate", DbType.DateTime, model.BankLoanDate);
            db.AddInParameter(dbCommand, "ReceiveLoanDate", DbType.DateTime, model.ReceiveLoanDate);
            db.AddInParameter(dbCommand, "SendToBankDate", DbType.DateTime, model.SendToBankDate);
            db.AddInParameter(dbCommand, "VoucherToBankDate", DbType.DateTime, model.VoucherToBankDate);
            db.AddInParameter(dbCommand, "CertificateDate", DbType.DateTime, model.CertificateDate);
            db.AddInParameter(dbCommand, "BankCompleteDate", DbType.DateTime, model.BankCompleteDate);
            db.AddInParameter(dbCommand, "SLDate", DbType.DateTime, model.SLDate);
            db.AddInParameter(dbCommand, "SHDate", DbType.DateTime, model.SHDate);
            db.AddInParameter(dbCommand, "FKDate", DbType.DateTime, model.FKDate);
            db.AddInParameter(dbCommand, "UpSLDate", DbType.DateTime, model.UpSLDate);
            db.AddInParameter(dbCommand, "UpSHDate", DbType.DateTime, model.UpSHDate);
            db.AddInParameter(dbCommand, "UpFKDate", DbType.DateTime, model.UpFKDate);
            db.AddInParameter(dbCommand, "EvaluateFeeDate", DbType.DateTime, model.EvaluateFeeDate);
            db.AddInParameter(dbCommand, "VouchFeeDate", DbType.DateTime, model.VouchFeeDate);
            db.AddInParameter(dbCommand, "InsuranceFeeDate", DbType.DateTime, model.InsuranceFeeDate);
            db.AddInParameter(dbCommand, "AgencyFeeDate", DbType.DateTime, model.AgencyFeeDate);
            db.AddInParameter(dbCommand, "OutVouchFeeDate", DbType.DateTime, model.OutVouchFeeDate);
            db.AddInParameter(dbCommand, "EndDate", DbType.DateTime, model.EndDate);
            db.AddInParameter(dbCommand, "EstimReportBackDate", DbType.DateTime, model.EstimReportBackDate);
            db.AddInParameter(dbCommand, "CompleteLoanDate", DbType.DateTime, model.CompleteLoanDate);
            db.AddInParameter(dbCommand, "TJDate", DbType.DateTime, model.TJDate);
            db.AddInParameter(dbCommand, "IsNoEvaluateFee", DbType.Boolean, model.IsNoEvaluateFee);
            db.AddInParameter(dbCommand, "IdBankReceipt", DbType.Boolean, model.IdBankReceipt);
            db.AddInParameter(dbCommand, "IdZhuanBen", DbType.Boolean, model.IdZhuanBen);
            db.AddInParameter(dbCommand, "IsNoAgencyFee", DbType.Boolean, model.IsNoAgencyFee);
            db.AddInParameter(dbCommand, "IdShouBen", DbType.Boolean, model.IdShouBen);
            db.AddInParameter(dbCommand, "IsLack", DbType.Boolean, model.IsLack);
            db.AddInParameter(dbCommand, "Receipt", DbType.Boolean, model.Receipt);
            db.AddInParameter(dbCommand, "Mortgage", DbType.Boolean, model.Mortgage);
            db.AddInParameter(dbCommand, "Status", DbType.Int32, model.Status);
            db.AddInParameter(dbCommand, "CompleteYear", DbType.Int32, model.CompleteYear);
            db.AddInParameter(dbCommand, "Total_Floor", DbType.Int32, model.Total_Floor);
            db.AddInParameter(dbCommand, "TJPercent", DbType.Int32, model.TJPercent);
            db.ExecuteNonQuery(dbCommand);
            strSql = new StringBuilder();
            db = DatabaseFactory.CreateDatabase("Chenxin_Business");
            strSql.AppendFormat("update t_Preliminary_BaseInfo set PreliminaryStatus = 70 where RecordId = '{0}'", model.MainId);
            dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.ExecuteNonQuery(dbCommand);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static void Update(Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update t_Preliminary_SubInfo3 set ");
            strSql.Append("MainId=@MainId,");
            strSql.Append("EmpCityId=@EmpCityId,");
            strSql.Append("EmpCompanyId=@EmpCompanyId,");
            strSql.Append("EmpDepartId=@EmpDepartId,");
            strSql.Append("EmployeeId=@EmployeeId,");
            strSql.Append("OperateCompanyId=@OperateCompanyId,");
            strSql.Append("OperateDepartId=@OperateDepartId,");
            strSql.Append("OperateUserId=@OperateUserId,");
            strSql.Append("ContractId=@ContractId,");
            strSql.Append("LoanCode=@LoanCode,");
            strSql.Append("LoanInfo=@LoanInfo,");
            strSql.Append("LoanDealMode=@LoanDealMode,");
            strSql.Append("ContractCode=@ContractCode,");
            strSql.Append("EvaluateCorp=@EvaluateCorp,");
            strSql.Append("InsuranceCorp=@InsuranceCorp,");
            strSql.Append("LackInfo=@LackInfo,");
            strSql.Append("ReceiveBank=@ReceiveBank,");
            strSql.Append("LoanXfYear=@LoanXfYear,");
            strSql.Append("LoanSxYear=@LoanSxYear,");
            strSql.Append("LoanZyYear=@LoanZyYear,");
            strSql.Append("SalerPhone=@SalerPhone,");
            strSql.Append("BuyerPhone=@BuyerPhone,");
            strSql.Append("CustomerName=@CustomerName,");
            strSql.Append("IDNum=@IDNum,");
            strSql.Append("GJJyear=@GJJyear,");
            strSql.Append("SYYear=@SYYear,");
            strSql.Append("OrderPlace=@OrderPlace,");
            strSql.Append("SaleName=@SaleName,");
            strSql.Append("SaleIDCard=@SaleIDCard,");
            strSql.Append("OldLoanBank=@OldLoanBank,");
            strSql.Append("EmpCityName=@EmpCityName,");
            strSql.Append("EmpCompanyName=@EmpCompanyName,");
            strSql.Append("EmpDepartName=@EmpDepartName,");
            strSql.Append("EmployeeName=@EmployeeName,");
            strSql.Append("EmpPhone=@EmpPhone,");
            strSql.Append("OperateCompanyName=@OperateCompanyName,");
            strSql.Append("OperateDepartName=@OperateDepartName,");
            strSql.Append("OperateUserName=@OperateUserName,");
            strSql.Append("Address=@Address,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("SLRemark=@SLRemark,");
            strSql.Append("SHRemark=@SHRemark,");
            strSql.Append("FKRemark=@FKRemark,");
            strSql.Append("SalePrice_T=@SalePrice_T,");
            strSql.Append("EvaluateFee=@EvaluateFee,");
            strSql.Append("InsuranceFee=@InsuranceFee,");
            strSql.Append("AgencyFee=@AgencyFee,");
            strSql.Append("OutVouchFee=@OutVouchFee,");
            strSql.Append("VouchFee=@VouchFee,");
            strSql.Append("LoanXf=@LoanXf,");
            strSql.Append("LoanSx=@LoanSx,");
            strSql.Append("LoanZy=@LoanZy,");
            strSql.Append("BankQueryFee=@BankQueryFee,");
            strSql.Append("BankManageFee=@BankManageFee,");
            strSql.Append("LoanBankSaleComplete=@LoanBankSaleComplete,");
            strSql.Append("EstimatePrice=@EstimatePrice,");
            strSql.Append("GJJmoney=@GJJmoney,");
            strSql.Append("SYMoney=@SYMoney,");
            strSql.Append("OldLoanMoney=@OldLoanMoney,");
            strSql.Append("OldRestMoney=@OldRestMoney,");
            strSql.Append("TJMoney=@TJMoney,");
            strSql.Append("BuildingArea=@BuildingArea,");
            strSql.Append("LoanContractDate=@LoanContractDate,");
            strSql.Append("MortgageClearDate=@MortgageClearDate,");
            strSql.Append("LoanComplete=@LoanComplete,");
            strSql.Append("BankLoanDate=@BankLoanDate,");
            strSql.Append("ReceiveLoanDate=@ReceiveLoanDate,");
            strSql.Append("SendToBankDate=@SendToBankDate,");
            strSql.Append("VoucherToBankDate=@VoucherToBankDate,");
            strSql.Append("CertificateDate=@CertificateDate,");
            strSql.Append("BankCompleteDate=@BankCompleteDate,");
            strSql.Append("SLDate=@SLDate,");
            strSql.Append("SHDate=@SHDate,");
            strSql.Append("FKDate=@FKDate,");
            strSql.Append("UpSLDate=@UpSLDate,");
            strSql.Append("UpSHDate=@UpSHDate,");
            strSql.Append("UpFKDate=@UpFKDate,");
            strSql.Append("EvaluateFeeDate=@EvaluateFeeDate,");
            strSql.Append("VouchFeeDate=@VouchFeeDate,");
            strSql.Append("InsuranceFeeDate=@InsuranceFeeDate,");
            strSql.Append("AgencyFeeDate=@AgencyFeeDate,");
            strSql.Append("OutVouchFeeDate=@OutVouchFeeDate,");
            strSql.Append("EndDate=@EndDate,");
            strSql.Append("EstimReportBackDate=@EstimReportBackDate,");
            strSql.Append("CompleteLoanDate=@CompleteLoanDate,");
            strSql.Append("TJDate=@TJDate,");
            strSql.Append("IsNoEvaluateFee=@IsNoEvaluateFee,");
            strSql.Append("IdBankReceipt=@IdBankReceipt,");
            strSql.Append("IdZhuanBen=@IdZhuanBen,");
            strSql.Append("IsNoAgencyFee=@IsNoAgencyFee,");
            strSql.Append("IdShouBen=@IdShouBen,");
            strSql.Append("IsLack=@IsLack,");
            strSql.Append("Receipt=@Receipt,");
            strSql.Append("Mortgage=@Mortgage,");
            strSql.Append("Status=@Status,");
            strSql.Append("CompleteYear=@CompleteYear,");
            strSql.Append("Total_Floor=@Total_Floor,");
            strSql.Append("TJPercent=@TJPercent");
            strSql.Append(" where RecordId=@RecordId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, model.RecordId);
            db.AddInParameter(dbCommand, "MainId", DbType.Guid, model.MainId);
            db.AddInParameter(dbCommand, "EmpCityId", DbType.Guid, model.EmpCityId);
            db.AddInParameter(dbCommand, "EmpCompanyId", DbType.Guid, model.EmpCompanyId);
            db.AddInParameter(dbCommand, "EmpDepartId", DbType.Guid, model.EmpDepartId);
            db.AddInParameter(dbCommand, "EmployeeId", DbType.Guid, model.EmployeeId);
            db.AddInParameter(dbCommand, "OperateCompanyId", DbType.Guid, model.OperateCompanyId);
            db.AddInParameter(dbCommand, "OperateDepartId", DbType.Guid, model.OperateDepartId);
            db.AddInParameter(dbCommand, "OperateUserId", DbType.Guid, model.OperateUserId);
            db.AddInParameter(dbCommand, "ContractId", DbType.Guid, model.ContractId);
            db.AddInParameter(dbCommand, "LoanCode", DbType.AnsiString, model.LoanCode);
            db.AddInParameter(dbCommand, "LoanInfo", DbType.AnsiString, model.LoanInfo);
            db.AddInParameter(dbCommand, "LoanDealMode", DbType.AnsiString, model.LoanDealMode);
            db.AddInParameter(dbCommand, "ContractCode", DbType.AnsiString, model.ContractCode);
            db.AddInParameter(dbCommand, "EvaluateCorp", DbType.AnsiString, model.EvaluateCorp);
            db.AddInParameter(dbCommand, "InsuranceCorp", DbType.AnsiString, model.InsuranceCorp);
            db.AddInParameter(dbCommand, "LackInfo", DbType.AnsiString, model.LackInfo);
            db.AddInParameter(dbCommand, "ReceiveBank", DbType.AnsiString, model.ReceiveBank);
            db.AddInParameter(dbCommand, "LoanXfYear", DbType.AnsiString, model.LoanXfYear);
            db.AddInParameter(dbCommand, "LoanSxYear", DbType.AnsiString, model.LoanSxYear);
            db.AddInParameter(dbCommand, "LoanZyYear", DbType.AnsiString, model.LoanZyYear);
            db.AddInParameter(dbCommand, "SalerPhone", DbType.AnsiString, model.SalerPhone);
            db.AddInParameter(dbCommand, "BuyerPhone", DbType.AnsiString, model.BuyerPhone);
            db.AddInParameter(dbCommand, "CustomerName", DbType.AnsiString, model.CustomerName);
            db.AddInParameter(dbCommand, "IDNum", DbType.AnsiString, model.IDNum);
            db.AddInParameter(dbCommand, "GJJyear", DbType.AnsiString, model.GJJyear);
            db.AddInParameter(dbCommand, "SYYear", DbType.AnsiString, model.SYYear);
            db.AddInParameter(dbCommand, "OrderPlace", DbType.AnsiString, model.OrderPlace);
            db.AddInParameter(dbCommand, "SaleName", DbType.AnsiString, model.SaleName);
            db.AddInParameter(dbCommand, "SaleIDCard", DbType.AnsiString, model.SaleIDCard);
            db.AddInParameter(dbCommand, "OldLoanBank", DbType.AnsiString, model.OldLoanBank);
            db.AddInParameter(dbCommand, "EmpCityName", DbType.AnsiString, model.EmpCityName);
            db.AddInParameter(dbCommand, "EmpCompanyName", DbType.AnsiString, model.EmpCompanyName);
            db.AddInParameter(dbCommand, "EmpDepartName", DbType.AnsiString, model.EmpDepartName);
            db.AddInParameter(dbCommand, "EmployeeName", DbType.AnsiString, model.EmployeeName);
            db.AddInParameter(dbCommand, "EmpPhone", DbType.AnsiString, model.EmpPhone);
            db.AddInParameter(dbCommand, "OperateCompanyName", DbType.AnsiString, model.OperateCompanyName);
            db.AddInParameter(dbCommand, "OperateDepartName", DbType.AnsiString, model.OperateDepartName);
            db.AddInParameter(dbCommand, "OperateUserName", DbType.AnsiString, model.OperateUserName);
            db.AddInParameter(dbCommand, "Address", DbType.AnsiString, model.Address);
            db.AddInParameter(dbCommand, "Remark", DbType.AnsiString, model.Remark);
            db.AddInParameter(dbCommand, "SLRemark", DbType.AnsiString, model.SLRemark);
            db.AddInParameter(dbCommand, "SHRemark", DbType.AnsiString, model.SHRemark);
            db.AddInParameter(dbCommand, "FKRemark", DbType.AnsiString, model.FKRemark);
            db.AddInParameter(dbCommand, "SalePrice_T", DbType.Decimal, model.SalePrice_T);
            db.AddInParameter(dbCommand, "EvaluateFee", DbType.Decimal, model.EvaluateFee);
            db.AddInParameter(dbCommand, "InsuranceFee", DbType.Decimal, model.InsuranceFee);
            db.AddInParameter(dbCommand, "AgencyFee", DbType.Decimal, model.AgencyFee);
            db.AddInParameter(dbCommand, "OutVouchFee", DbType.Decimal, model.OutVouchFee);
            db.AddInParameter(dbCommand, "VouchFee", DbType.Decimal, model.VouchFee);
            db.AddInParameter(dbCommand, "LoanXf", DbType.Decimal, model.LoanXf);
            db.AddInParameter(dbCommand, "LoanSx", DbType.Decimal, model.LoanSx);
            db.AddInParameter(dbCommand, "LoanZy", DbType.Decimal, model.LoanZy);
            db.AddInParameter(dbCommand, "BankQueryFee", DbType.Decimal, model.BankQueryFee);
            db.AddInParameter(dbCommand, "BankManageFee", DbType.Decimal, model.BankManageFee);
            db.AddInParameter(dbCommand, "LoanBankSaleComplete", DbType.Decimal, model.LoanBankSaleComplete);
            db.AddInParameter(dbCommand, "EstimatePrice", DbType.Decimal, model.EstimatePrice);
            db.AddInParameter(dbCommand, "GJJmoney", DbType.Decimal, model.GJJmoney);
            db.AddInParameter(dbCommand, "SYMoney", DbType.Decimal, model.SYMoney);
            db.AddInParameter(dbCommand, "OldLoanMoney", DbType.Decimal, model.OldLoanMoney);
            db.AddInParameter(dbCommand, "OldRestMoney", DbType.Decimal, model.OldRestMoney);
            db.AddInParameter(dbCommand, "TJMoney", DbType.Decimal, model.TJMoney);
            db.AddInParameter(dbCommand, "BuildingArea", DbType.Decimal, model.BuildingArea);
            db.AddInParameter(dbCommand, "LoanContractDate", DbType.DateTime, model.LoanContractDate);
            db.AddInParameter(dbCommand, "MortgageClearDate", DbType.DateTime, model.MortgageClearDate);
            db.AddInParameter(dbCommand, "LoanComplete", DbType.DateTime, model.LoanComplete);
            db.AddInParameter(dbCommand, "BankLoanDate", DbType.DateTime, model.BankLoanDate);
            db.AddInParameter(dbCommand, "ReceiveLoanDate", DbType.DateTime, model.ReceiveLoanDate);
            db.AddInParameter(dbCommand, "SendToBankDate", DbType.DateTime, model.SendToBankDate);
            db.AddInParameter(dbCommand, "VoucherToBankDate", DbType.DateTime, model.VoucherToBankDate);
            db.AddInParameter(dbCommand, "CertificateDate", DbType.DateTime, model.CertificateDate);
            db.AddInParameter(dbCommand, "BankCompleteDate", DbType.DateTime, model.BankCompleteDate);
            db.AddInParameter(dbCommand, "SLDate", DbType.DateTime, model.SLDate);
            db.AddInParameter(dbCommand, "SHDate", DbType.DateTime, model.SHDate);
            db.AddInParameter(dbCommand, "FKDate", DbType.DateTime, model.FKDate);
            db.AddInParameter(dbCommand, "UpSLDate", DbType.DateTime, model.UpSLDate);
            db.AddInParameter(dbCommand, "UpSHDate", DbType.DateTime, model.UpSHDate);
            db.AddInParameter(dbCommand, "UpFKDate", DbType.DateTime, model.UpFKDate);
            db.AddInParameter(dbCommand, "EvaluateFeeDate", DbType.DateTime, model.EvaluateFeeDate);
            db.AddInParameter(dbCommand, "VouchFeeDate", DbType.DateTime, model.VouchFeeDate);
            db.AddInParameter(dbCommand, "InsuranceFeeDate", DbType.DateTime, model.InsuranceFeeDate);
            db.AddInParameter(dbCommand, "AgencyFeeDate", DbType.DateTime, model.AgencyFeeDate);
            db.AddInParameter(dbCommand, "OutVouchFeeDate", DbType.DateTime, model.OutVouchFeeDate);
            db.AddInParameter(dbCommand, "EndDate", DbType.DateTime, model.EndDate);
            db.AddInParameter(dbCommand, "EstimReportBackDate", DbType.DateTime, model.EstimReportBackDate);
            db.AddInParameter(dbCommand, "CompleteLoanDate", DbType.DateTime, model.CompleteLoanDate);
            db.AddInParameter(dbCommand, "TJDate", DbType.DateTime, model.TJDate);
            db.AddInParameter(dbCommand, "IsNoEvaluateFee", DbType.Boolean, model.IsNoEvaluateFee);
            db.AddInParameter(dbCommand, "IdBankReceipt", DbType.Boolean, model.IdBankReceipt);
            db.AddInParameter(dbCommand, "IdZhuanBen", DbType.Boolean, model.IdZhuanBen);
            db.AddInParameter(dbCommand, "IsNoAgencyFee", DbType.Boolean, model.IsNoAgencyFee);
            db.AddInParameter(dbCommand, "IdShouBen", DbType.Boolean, model.IdShouBen);
            db.AddInParameter(dbCommand, "IsLack", DbType.Boolean, model.IsLack);
            db.AddInParameter(dbCommand, "Receipt", DbType.Boolean, model.Receipt);
            db.AddInParameter(dbCommand, "Mortgage", DbType.Boolean, model.Mortgage);
            db.AddInParameter(dbCommand, "Status", DbType.Int32, model.Status);
            db.AddInParameter(dbCommand, "CompleteYear", DbType.Int32, model.CompleteYear);
            db.AddInParameter(dbCommand, "Total_Floor", DbType.Int32, model.Total_Floor);
            db.AddInParameter(dbCommand, "TJPercent", DbType.Int32, model.TJPercent);
            db.ExecuteNonQuery(dbCommand);
            switch (model.Status)
            {
                case 20:
                    db = DatabaseFactory.CreateDatabase("Chenxin_Business");
                    strSql = new StringBuilder();
                    strSql.AppendFormat("update t_Preliminary_BaseInfo set PreliminaryStatus = 70 where RecordId = '{0}'", model.MainId);
                    dbCommand = db.GetSqlStringCommand(strSql.ToString());
                    db.ExecuteNonQuery(dbCommand);
                    break;
                case 30:
                    db = DatabaseFactory.CreateDatabase("Chenxin_Business");
                    strSql = new StringBuilder();
                    strSql.AppendFormat("update t_Preliminary_BaseInfo set PreliminaryStatus = 80 where RecordId = '{0}'", model.MainId);
                    dbCommand = db.GetSqlStringCommand(strSql.ToString());
                    db.ExecuteNonQuery(dbCommand);
                    break;
                case 50:
                    db = DatabaseFactory.CreateDatabase("Chenxin_Business");
                    strSql = new StringBuilder();
                    strSql.AppendFormat("update t_Preliminary_BaseInfo set PreliminaryStatus = 90 where RecordId = '{0}'", model.MainId);
                    dbCommand = db.GetSqlStringCommand(strSql.ToString());
                    db.ExecuteNonQuery(dbCommand);
                    break;
            }
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static void UpdateByContractId(Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update t_Preliminary_SubInfo3 set ");
            strSql.Append("MainId=@MainId,");
            strSql.Append("EmpCityId=@EmpCityId,");
            strSql.Append("EmpCompanyId=@EmpCompanyId,");
            strSql.Append("EmpDepartId=@EmpDepartId,");
            strSql.Append("EmployeeId=@EmployeeId,");
            strSql.Append("OperateCompanyId=@OperateCompanyId,");
            strSql.Append("OperateDepartId=@OperateDepartId,");
            strSql.Append("OperateUserId=@OperateUserId,");
            strSql.Append("ContractId=@ContractId,");
            strSql.Append("LoanCode=@LoanCode,");
            strSql.Append("LoanInfo=@LoanInfo,");
            strSql.Append("LoanDealMode=@LoanDealMode,");
            strSql.Append("ContractCode=@ContractCode,");
            strSql.Append("EvaluateCorp=@EvaluateCorp,");
            strSql.Append("InsuranceCorp=@InsuranceCorp,");
            strSql.Append("LackInfo=@LackInfo,");
            strSql.Append("ReceiveBank=@ReceiveBank,");
            strSql.Append("LoanXfYear=@LoanXfYear,");
            strSql.Append("LoanSxYear=@LoanSxYear,");
            strSql.Append("LoanZyYear=@LoanZyYear,");
            strSql.Append("SalerPhone=@SalerPhone,");
            strSql.Append("BuyerPhone=@BuyerPhone,");
            strSql.Append("CustomerName=@CustomerName,");
            strSql.Append("IDNum=@IDNum,");
            strSql.Append("GJJyear=@GJJyear,");
            strSql.Append("SYYear=@SYYear,");
            strSql.Append("OrderPlace=@OrderPlace,");
            strSql.Append("SaleName=@SaleName,");
            strSql.Append("SaleIDCard=@SaleIDCard,");
            strSql.Append("OldLoanBank=@OldLoanBank,");
            strSql.Append("EmpCityName=@EmpCityName,");
            strSql.Append("EmpCompanyName=@EmpCompanyName,");
            strSql.Append("EmpDepartName=@EmpDepartName,");
            strSql.Append("EmployeeName=@EmployeeName,");
            strSql.Append("EmpPhone=@EmpPhone,");
            strSql.Append("OperateCompanyName=@OperateCompanyName,");
            strSql.Append("OperateDepartName=@OperateDepartName,");
            strSql.Append("OperateUserName=@OperateUserName,");
            strSql.Append("Address=@Address,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("SLRemark=@SLRemark,");
            strSql.Append("SHRemark=@SHRemark,");
            strSql.Append("FKRemark=@FKRemark,");
            strSql.Append("SalePrice_T=@SalePrice_T,");
            strSql.Append("EvaluateFee=@EvaluateFee,");
            strSql.Append("InsuranceFee=@InsuranceFee,");
            strSql.Append("AgencyFee=@AgencyFee,");
            strSql.Append("OutVouchFee=@OutVouchFee,");
            strSql.Append("VouchFee=@VouchFee,");
            strSql.Append("LoanXf=@LoanXf,");
            strSql.Append("LoanSx=@LoanSx,");
            strSql.Append("LoanZy=@LoanZy,");
            strSql.Append("BankQueryFee=@BankQueryFee,");
            strSql.Append("BankManageFee=@BankManageFee,");
            strSql.Append("LoanBankSaleComplete=@LoanBankSaleComplete,");
            strSql.Append("EstimatePrice=@EstimatePrice,");
            strSql.Append("GJJmoney=@GJJmoney,");
            strSql.Append("SYMoney=@SYMoney,");
            strSql.Append("OldLoanMoney=@OldLoanMoney,");
            strSql.Append("OldRestMoney=@OldRestMoney,");
            strSql.Append("TJMoney=@TJMoney,");
            strSql.Append("BuildingArea=@BuildingArea,");
            strSql.Append("LoanContractDate=@LoanContractDate,");
            strSql.Append("MortgageClearDate=@MortgageClearDate,");
            strSql.Append("LoanComplete=@LoanComplete,");
            strSql.Append("BankLoanDate=@BankLoanDate,");
            strSql.Append("ReceiveLoanDate=@ReceiveLoanDate,");
            strSql.Append("SendToBankDate=@SendToBankDate,");
            strSql.Append("VoucherToBankDate=@VoucherToBankDate,");
            strSql.Append("CertificateDate=@CertificateDate,");
            strSql.Append("BankCompleteDate=@BankCompleteDate,");
            strSql.Append("SLDate=@SLDate,");
            strSql.Append("SHDate=@SHDate,");
            strSql.Append("FKDate=@FKDate,");
            strSql.Append("UpSLDate=@UpSLDate,");
            strSql.Append("UpSHDate=@UpSHDate,");
            strSql.Append("UpFKDate=@UpFKDate,");
            strSql.Append("EvaluateFeeDate=@EvaluateFeeDate,");
            strSql.Append("VouchFeeDate=@VouchFeeDate,");
            strSql.Append("InsuranceFeeDate=@InsuranceFeeDate,");
            strSql.Append("AgencyFeeDate=@AgencyFeeDate,");
            strSql.Append("OutVouchFeeDate=@OutVouchFeeDate,");
            strSql.Append("EndDate=@EndDate,");
            strSql.Append("EstimReportBackDate=@EstimReportBackDate,");
            strSql.Append("CompleteLoanDate=@CompleteLoanDate,");
            strSql.Append("TJDate=@TJDate,");
            strSql.Append("IsNoEvaluateFee=@IsNoEvaluateFee,");
            strSql.Append("IdBankReceipt=@IdBankReceipt,");
            strSql.Append("IdZhuanBen=@IdZhuanBen,");
            strSql.Append("IsNoAgencyFee=@IsNoAgencyFee,");
            strSql.Append("IdShouBen=@IdShouBen,");
            strSql.Append("IsLack=@IsLack,");
            strSql.Append("Receipt=@Receipt,");
            strSql.Append("Mortgage=@Mortgage,");
            strSql.Append("Status=@Status,");
            strSql.Append("CompleteYear=@CompleteYear,");
            strSql.Append("Total_Floor=@Total_Floor,");
            strSql.Append("TJPercent=@TJPercent");
            strSql.Append(" where ContractId=@ContractId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, model.RecordId);
            db.AddInParameter(dbCommand, "MainId", DbType.Guid, model.MainId);
            db.AddInParameter(dbCommand, "EmpCityId", DbType.Guid, model.EmpCityId);
            db.AddInParameter(dbCommand, "EmpCompanyId", DbType.Guid, model.EmpCompanyId);
            db.AddInParameter(dbCommand, "EmpDepartId", DbType.Guid, model.EmpDepartId);
            db.AddInParameter(dbCommand, "EmployeeId", DbType.Guid, model.EmployeeId);
            db.AddInParameter(dbCommand, "OperateCompanyId", DbType.Guid, model.OperateCompanyId);
            db.AddInParameter(dbCommand, "OperateDepartId", DbType.Guid, model.OperateDepartId);
            db.AddInParameter(dbCommand, "OperateUserId", DbType.Guid, model.OperateUserId);
            db.AddInParameter(dbCommand, "ContractId", DbType.Guid, model.ContractId);
            db.AddInParameter(dbCommand, "LoanCode", DbType.AnsiString, model.LoanCode);
            db.AddInParameter(dbCommand, "LoanInfo", DbType.AnsiString, model.LoanInfo);
            db.AddInParameter(dbCommand, "LoanDealMode", DbType.AnsiString, model.LoanDealMode);
            db.AddInParameter(dbCommand, "ContractCode", DbType.AnsiString, model.ContractCode);
            db.AddInParameter(dbCommand, "EvaluateCorp", DbType.AnsiString, model.EvaluateCorp);
            db.AddInParameter(dbCommand, "InsuranceCorp", DbType.AnsiString, model.InsuranceCorp);
            db.AddInParameter(dbCommand, "LackInfo", DbType.AnsiString, model.LackInfo);
            db.AddInParameter(dbCommand, "ReceiveBank", DbType.AnsiString, model.ReceiveBank);
            db.AddInParameter(dbCommand, "LoanXfYear", DbType.AnsiString, model.LoanXfYear);
            db.AddInParameter(dbCommand, "LoanSxYear", DbType.AnsiString, model.LoanSxYear);
            db.AddInParameter(dbCommand, "LoanZyYear", DbType.AnsiString, model.LoanZyYear);
            db.AddInParameter(dbCommand, "SalerPhone", DbType.AnsiString, model.SalerPhone);
            db.AddInParameter(dbCommand, "BuyerPhone", DbType.AnsiString, model.BuyerPhone);
            db.AddInParameter(dbCommand, "CustomerName", DbType.AnsiString, model.CustomerName);
            db.AddInParameter(dbCommand, "IDNum", DbType.AnsiString, model.IDNum);
            db.AddInParameter(dbCommand, "GJJyear", DbType.AnsiString, model.GJJyear);
            db.AddInParameter(dbCommand, "SYYear", DbType.AnsiString, model.SYYear);
            db.AddInParameter(dbCommand, "OrderPlace", DbType.AnsiString, model.OrderPlace);
            db.AddInParameter(dbCommand, "SaleName", DbType.AnsiString, model.SaleName);
            db.AddInParameter(dbCommand, "SaleIDCard", DbType.AnsiString, model.SaleIDCard);
            db.AddInParameter(dbCommand, "OldLoanBank", DbType.AnsiString, model.OldLoanBank);
            db.AddInParameter(dbCommand, "EmpCityName", DbType.AnsiString, model.EmpCityName);
            db.AddInParameter(dbCommand, "EmpCompanyName", DbType.AnsiString, model.EmpCompanyName);
            db.AddInParameter(dbCommand, "EmpDepartName", DbType.AnsiString, model.EmpDepartName);
            db.AddInParameter(dbCommand, "EmployeeName", DbType.AnsiString, model.EmployeeName);
            db.AddInParameter(dbCommand, "EmpPhone", DbType.AnsiString, model.EmpPhone);
            db.AddInParameter(dbCommand, "OperateCompanyName", DbType.AnsiString, model.OperateCompanyName);
            db.AddInParameter(dbCommand, "OperateDepartName", DbType.AnsiString, model.OperateDepartName);
            db.AddInParameter(dbCommand, "OperateUserName", DbType.AnsiString, model.OperateUserName);
            db.AddInParameter(dbCommand, "Address", DbType.AnsiString, model.Address);
            db.AddInParameter(dbCommand, "Remark", DbType.AnsiString, model.Remark);
            db.AddInParameter(dbCommand, "SLRemark", DbType.AnsiString, model.SLRemark);
            db.AddInParameter(dbCommand, "SHRemark", DbType.AnsiString, model.SHRemark);
            db.AddInParameter(dbCommand, "FKRemark", DbType.AnsiString, model.FKRemark);
            db.AddInParameter(dbCommand, "SalePrice_T", DbType.Decimal, model.SalePrice_T);
            db.AddInParameter(dbCommand, "EvaluateFee", DbType.Decimal, model.EvaluateFee);
            db.AddInParameter(dbCommand, "InsuranceFee", DbType.Decimal, model.InsuranceFee);
            db.AddInParameter(dbCommand, "AgencyFee", DbType.Decimal, model.AgencyFee);
            db.AddInParameter(dbCommand, "OutVouchFee", DbType.Decimal, model.OutVouchFee);
            db.AddInParameter(dbCommand, "VouchFee", DbType.Decimal, model.VouchFee);
            db.AddInParameter(dbCommand, "LoanXf", DbType.Decimal, model.LoanXf);
            db.AddInParameter(dbCommand, "LoanSx", DbType.Decimal, model.LoanSx);
            db.AddInParameter(dbCommand, "LoanZy", DbType.Decimal, model.LoanZy);
            db.AddInParameter(dbCommand, "BankQueryFee", DbType.Decimal, model.BankQueryFee);
            db.AddInParameter(dbCommand, "BankManageFee", DbType.Decimal, model.BankManageFee);
            db.AddInParameter(dbCommand, "LoanBankSaleComplete", DbType.Decimal, model.LoanBankSaleComplete);
            db.AddInParameter(dbCommand, "EstimatePrice", DbType.Decimal, model.EstimatePrice);
            db.AddInParameter(dbCommand, "GJJmoney", DbType.Decimal, model.GJJmoney);
            db.AddInParameter(dbCommand, "SYMoney", DbType.Decimal, model.SYMoney);
            db.AddInParameter(dbCommand, "OldLoanMoney", DbType.Decimal, model.OldLoanMoney);
            db.AddInParameter(dbCommand, "OldRestMoney", DbType.Decimal, model.OldRestMoney);
            db.AddInParameter(dbCommand, "TJMoney", DbType.Decimal, model.TJMoney);
            db.AddInParameter(dbCommand, "BuildingArea", DbType.Decimal, model.BuildingArea);
            db.AddInParameter(dbCommand, "LoanContractDate", DbType.DateTime, model.LoanContractDate);
            db.AddInParameter(dbCommand, "MortgageClearDate", DbType.DateTime, model.MortgageClearDate);
            db.AddInParameter(dbCommand, "LoanComplete", DbType.DateTime, model.LoanComplete);
            db.AddInParameter(dbCommand, "BankLoanDate", DbType.DateTime, model.BankLoanDate);
            db.AddInParameter(dbCommand, "ReceiveLoanDate", DbType.DateTime, model.ReceiveLoanDate);
            db.AddInParameter(dbCommand, "SendToBankDate", DbType.DateTime, model.SendToBankDate);
            db.AddInParameter(dbCommand, "VoucherToBankDate", DbType.DateTime, model.VoucherToBankDate);
            db.AddInParameter(dbCommand, "CertificateDate", DbType.DateTime, model.CertificateDate);
            db.AddInParameter(dbCommand, "BankCompleteDate", DbType.DateTime, model.BankCompleteDate);
            db.AddInParameter(dbCommand, "SLDate", DbType.DateTime, model.SLDate);
            db.AddInParameter(dbCommand, "SHDate", DbType.DateTime, model.SHDate);
            db.AddInParameter(dbCommand, "FKDate", DbType.DateTime, model.FKDate);
            db.AddInParameter(dbCommand, "UpSLDate", DbType.DateTime, model.UpSLDate);
            db.AddInParameter(dbCommand, "UpSHDate", DbType.DateTime, model.UpSHDate);
            db.AddInParameter(dbCommand, "UpFKDate", DbType.DateTime, model.UpFKDate);
            db.AddInParameter(dbCommand, "EvaluateFeeDate", DbType.DateTime, model.EvaluateFeeDate);
            db.AddInParameter(dbCommand, "VouchFeeDate", DbType.DateTime, model.VouchFeeDate);
            db.AddInParameter(dbCommand, "InsuranceFeeDate", DbType.DateTime, model.InsuranceFeeDate);
            db.AddInParameter(dbCommand, "AgencyFeeDate", DbType.DateTime, model.AgencyFeeDate);
            db.AddInParameter(dbCommand, "OutVouchFeeDate", DbType.DateTime, model.OutVouchFeeDate);
            db.AddInParameter(dbCommand, "EndDate", DbType.DateTime, model.EndDate);
            db.AddInParameter(dbCommand, "EstimReportBackDate", DbType.DateTime, model.EstimReportBackDate);
            db.AddInParameter(dbCommand, "CompleteLoanDate", DbType.DateTime, model.CompleteLoanDate);
            db.AddInParameter(dbCommand, "TJDate", DbType.DateTime, model.TJDate);
            db.AddInParameter(dbCommand, "IsNoEvaluateFee", DbType.Boolean, model.IsNoEvaluateFee);
            db.AddInParameter(dbCommand, "IdBankReceipt", DbType.Boolean, model.IdBankReceipt);
            db.AddInParameter(dbCommand, "IdZhuanBen", DbType.Boolean, model.IdZhuanBen);
            db.AddInParameter(dbCommand, "IsNoAgencyFee", DbType.Boolean, model.IsNoAgencyFee);
            db.AddInParameter(dbCommand, "IdShouBen", DbType.Boolean, model.IdShouBen);
            db.AddInParameter(dbCommand, "IsLack", DbType.Boolean, model.IsLack);
            db.AddInParameter(dbCommand, "Receipt", DbType.Boolean, model.Receipt);
            db.AddInParameter(dbCommand, "Mortgage", DbType.Boolean, model.Mortgage);
            db.AddInParameter(dbCommand, "Status", DbType.Int32, model.Status);
            db.AddInParameter(dbCommand, "CompleteYear", DbType.Int32, model.CompleteYear);
            db.AddInParameter(dbCommand, "Total_Floor", DbType.Int32, model.Total_Floor);
            db.AddInParameter(dbCommand, "TJPercent", DbType.Int32, model.TJPercent);
            db.ExecuteNonQuery(dbCommand);
            switch (model.Status)
            {
                case 20:
                    db = DatabaseFactory.CreateDatabase("Chenxin_Business");
                    strSql = new StringBuilder();
                    strSql.AppendFormat("update t_Preliminary_BaseInfo set PreliminaryStatus = 70 where RecordId = '{0}'", model.MainId);
                    dbCommand = db.GetSqlStringCommand(strSql.ToString());
                    db.ExecuteNonQuery(dbCommand);
                    break;
                case 30:
                    db = DatabaseFactory.CreateDatabase("Chenxin_Business");
                    strSql = new StringBuilder();
                    strSql.AppendFormat("update t_Preliminary_BaseInfo set PreliminaryStatus = 80 where RecordId = '{0}'", model.MainId);
                    dbCommand = db.GetSqlStringCommand(strSql.ToString());
                    db.ExecuteNonQuery(dbCommand);
                    break;
                case 50:
                    db = DatabaseFactory.CreateDatabase("Chenxin_Business");
                    strSql = new StringBuilder();
                    strSql.AppendFormat("update t_Preliminary_BaseInfo set PreliminaryStatus = 90 where RecordId = '{0}'", model.MainId);
                    dbCommand = db.GetSqlStringCommand(strSql.ToString());
                    db.ExecuteNonQuery(dbCommand);
                    break;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public static void Delete(Guid RecordId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from t_Preliminary_SubInfo3 ");
            strSql.Append(" where RecordId=@RecordId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, RecordId);
            db.ExecuteNonQuery(dbCommand);

        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 GetModelByContractId(Guid RecordId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,MainId,EmpCityId,EmpCompanyId,EmpDepartId,EmployeeId,OperateCompanyId,OperateDepartId,OperateUserId,ContractId,LoanCode,LoanInfo,LoanDealMode,ContractCode,EvaluateCorp,InsuranceCorp,LackInfo,ReceiveBank,LoanXfYear,LoanSxYear,LoanZyYear,SalerPhone,BuyerPhone,CustomerName,IDNum,GJJyear,SYYear,OrderPlace,SaleName,SaleIDCard,OldLoanBank,EmpCityName,EmpCompanyName,EmpDepartName,EmployeeName,EmpPhone,OperateCompanyName,OperateDepartName,OperateUserName,Address,Remark,SLRemark,SHRemark,FKRemark,SalePrice_T,EvaluateFee,InsuranceFee,AgencyFee,OutVouchFee,VouchFee,LoanXf,LoanSx,LoanZy,BankQueryFee,BankManageFee,LoanBankSaleComplete,EstimatePrice,GJJmoney,SYMoney,OldLoanMoney,OldRestMoney,TJMoney,BuildingArea,LoanContractDate,MortgageClearDate,LoanComplete,BankLoanDate,ReceiveLoanDate,SendToBankDate,VoucherToBankDate,CertificateDate,BankCompleteDate,SLDate,SHDate,FKDate,UpSLDate,UpSHDate,UpFKDate,EvaluateFeeDate,VouchFeeDate,InsuranceFeeDate,AgencyFeeDate,OutVouchFeeDate,EndDate,EstimReportBackDate,CompleteLoanDate,TJDate,IsNoEvaluateFee,IdBankReceipt,IdZhuanBen,IsNoAgencyFee,IdShouBen,IsLack,Receipt,Mortgage,Status,CompleteYear,Total_Floor,TJPercent,CreateLoanGiveInfo ");
            strSql.Append(" FROM t_Preliminary_SubInfo3 ");
            strSql.AppendFormat(" where ContractId = '{0}' ", RecordId);
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return model;
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 GetLoanCode()
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select top 1 LoanCode from t_Preliminary_SubInfo3 order by LoanCode desc");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = Bind(dataReader);
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return model;
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 GetModel(Guid RecordId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,MainId,EmpCityId,EmpCompanyId,EmpDepartId,EmployeeId,OperateCompanyId,OperateDepartId,OperateUserId,ContractId,LoanCode,LoanInfo,LoanDealMode,ContractCode,EvaluateCorp,InsuranceCorp,LackInfo,ReceiveBank,LoanXfYear,LoanSxYear,LoanZyYear,SalerPhone,BuyerPhone,CustomerName,IDNum,GJJyear,SYYear,OrderPlace,SaleName,SaleIDCard,OldLoanBank,EmpCityName,EmpCompanyName,EmpDepartName,EmployeeName,EmpPhone,OperateCompanyName,OperateDepartName,OperateUserName,Address,Remark,SLRemark,SHRemark,FKRemark,SalePrice_T,EvaluateFee,InsuranceFee,AgencyFee,OutVouchFee,VouchFee,LoanXf,LoanSx,LoanZy,BankQueryFee,BankManageFee,LoanBankSaleComplete,EstimatePrice,GJJmoney,SYMoney,OldLoanMoney,OldRestMoney,TJMoney,BuildingArea,LoanContractDate,MortgageClearDate,LoanComplete,BankLoanDate,ReceiveLoanDate,SendToBankDate,VoucherToBankDate,CertificateDate,BankCompleteDate,SLDate,SHDate,FKDate,UpSLDate,UpSHDate,UpFKDate,EvaluateFeeDate,VouchFeeDate,InsuranceFeeDate,AgencyFeeDate,OutVouchFeeDate,EndDate,EstimReportBackDate,CompleteLoanDate,TJDate,IsNoEvaluateFee,IdBankReceipt,IdZhuanBen,IsNoAgencyFee,IdShouBen,IsLack,Receipt,Mortgage,Status,CompleteYear,Total_Floor,TJPercent,CreateLoanGiveInfo ");
            strSql.Append(" FROM t_Preliminary_SubInfo3 ");
            strSql.AppendFormat(" where MainId = '{0}' ", RecordId);
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return model;
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 GetModelByRecordId(Guid RecordId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,MainId,EmpCityId,EmpCompanyId,EmpDepartId,EmployeeId,OperateCompanyId,OperateDepartId,OperateUserId,ContractId,LoanCode,LoanInfo,LoanDealMode,ContractCode,EvaluateCorp,InsuranceCorp,LackInfo,ReceiveBank,LoanXfYear,LoanSxYear,LoanZyYear,SalerPhone,BuyerPhone,CustomerName,IDNum,GJJyear,SYYear,OrderPlace,SaleName,SaleIDCard,OldLoanBank,EmpCityName,EmpCompanyName,EmpDepartName,EmployeeName,EmpPhone,OperateCompanyName,OperateDepartName,OperateUserName,Address,Remark,SLRemark,SHRemark,FKRemark,SalePrice_T,EvaluateFee,InsuranceFee,AgencyFee,OutVouchFee,VouchFee,LoanXf,LoanSx,LoanZy,BankQueryFee,BankManageFee,LoanBankSaleComplete,EstimatePrice,GJJmoney,SYMoney,OldLoanMoney,OldRestMoney,TJMoney,BuildingArea,LoanContractDate,MortgageClearDate,LoanComplete,BankLoanDate,ReceiveLoanDate,SendToBankDate,VoucherToBankDate,CertificateDate,BankCompleteDate,SLDate,SHDate,FKDate,UpSLDate,UpSHDate,UpFKDate,EvaluateFeeDate,VouchFeeDate,InsuranceFeeDate,AgencyFeeDate,OutVouchFeeDate,EndDate,EstimReportBackDate,CompleteLoanDate,TJDate,IsNoEvaluateFee,IdBankReceipt,IdZhuanBen,IsNoAgencyFee,IdShouBen,IsLack,Receipt,Mortgage,Status,CompleteYear,Total_Floor,TJPercent,CreateLoanGiveInfo ");
            strSql.Append(" FROM t_Preliminary_SubInfo3 ");
            strSql.AppendFormat(" where RecordId = '{0}' ", RecordId);
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return model;
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 GetLoanModel(Guid RecordId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,MainId,EmpCityId,EmpCompanyId,EmpDepartId,EmployeeId,OperateCompanyId,OperateDepartId,OperateUserId,ContractId,LoanCode,LoanInfo,LoanDealMode,ContractCode,EvaluateCorp,InsuranceCorp,LackInfo,ReceiveBank,LoanXfYear,LoanSxYear,LoanZyYear,SalerPhone,BuyerPhone,CustomerName,IDNum,GJJyear,SYYear,OrderPlace,SaleName,SaleIDCard,OldLoanBank,EmpCityName,EmpCompanyName,EmpDepartName,EmployeeName,EmpPhone,OperateCompanyName,OperateDepartName,OperateUserName,Address,Remark,SLRemark,SHRemark,FKRemark,SalePrice_T,EvaluateFee,InsuranceFee,AgencyFee,OutVouchFee,VouchFee,LoanXf,LoanSx,LoanZy,BankQueryFee,BankManageFee,LoanBankSaleComplete,EstimatePrice,GJJmoney,SYMoney,OldLoanMoney,OldRestMoney,TJMoney,BuildingArea,LoanContractDate,MortgageClearDate,LoanComplete,BankLoanDate,ReceiveLoanDate,SendToBankDate,VoucherToBankDate,CertificateDate,BankCompleteDate,SLDate,SHDate,FKDate,UpSLDate,UpSHDate,UpFKDate,EvaluateFeeDate,VouchFeeDate,InsuranceFeeDate,AgencyFeeDate,OutVouchFeeDate,EndDate,EstimReportBackDate,CompleteLoanDate,TJDate,IsNoEvaluateFee,IdBankReceipt,IdZhuanBen,IsNoAgencyFee,IdShouBen,IsLack,Receipt,Mortgage,Status,CompleteYear,Total_Floor,TJPercent,CreateLoanGiveInfo ");
            strSql.Append(" FROM t_Preliminary_SubInfo3 ");
            strSql.AppendFormat(" where RecordId = '{0}' ", RecordId);
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return model;
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 GetLoanModelByMainId(Guid MainId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,MainId,EmpCityId,EmpCompanyId,EmpDepartId,EmployeeId,OperateCompanyId,OperateDepartId,OperateUserId,ContractId,LoanCode,LoanInfo,LoanDealMode,ContractCode,EvaluateCorp,InsuranceCorp,LackInfo,ReceiveBank,LoanXfYear,LoanSxYear,LoanZyYear,SalerPhone,BuyerPhone,CustomerName,IDNum,GJJyear,SYYear,OrderPlace,SaleName,SaleIDCard,OldLoanBank,EmpCityName,EmpCompanyName,EmpDepartName,EmployeeName,EmpPhone,OperateCompanyName,OperateDepartName,OperateUserName,Address,Remark,SLRemark,SHRemark,FKRemark,SalePrice_T,EvaluateFee,InsuranceFee,AgencyFee,OutVouchFee,VouchFee,LoanXf,LoanSx,LoanZy,BankQueryFee,BankManageFee,LoanBankSaleComplete,EstimatePrice,GJJmoney,SYMoney,OldLoanMoney,OldRestMoney,TJMoney,BuildingArea,LoanContractDate,MortgageClearDate,LoanComplete,BankLoanDate,ReceiveLoanDate,SendToBankDate,VoucherToBankDate,CertificateDate,BankCompleteDate,SLDate,SHDate,FKDate,UpSLDate,UpSHDate,UpFKDate,EvaluateFeeDate,VouchFeeDate,InsuranceFeeDate,AgencyFeeDate,OutVouchFeeDate,EndDate,EstimReportBackDate,CompleteLoanDate,TJDate,IsNoEvaluateFee,IdBankReceipt,IdZhuanBen,IsNoAgencyFee,IdShouBen,IsLack,Receipt,Mortgage,Status,CompleteYear,Total_Floor,TJPercent,CreateLoanGiveInfo ");
            strSql.Append(" FROM t_Preliminary_SubInfo3 ");
            strSql.AppendFormat(" where MainId = '{0}' ", MainId);
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public static DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,MainId,EmpCityId,EmpCompanyId,EmpDepartId,EmployeeId,OperateCompanyId,OperateDepartId,OperateUserId,ContractId,LoanCode,LoanInfo,LoanDealMode,ContractCode,EvaluateCorp,InsuranceCorp,LackInfo,ReceiveBank,LoanXfYear,LoanSxYear,LoanZyYear,SalerPhone,BuyerPhone,CustomerName,IDNum,GJJyear,SYYear,OrderPlace,SaleName,SaleIDCard,OldLoanBank,EmpCityName,EmpCompanyName,EmpDepartName,EmployeeName,EmpPhone,OperateCompanyName,OperateDepartName,OperateUserName,Address,Remark,SLRemark,SHRemark,FKRemark,SalePrice_T,EvaluateFee,InsuranceFee,AgencyFee,OutVouchFee,VouchFee,LoanXf,LoanSx,LoanZy,BankQueryFee,BankManageFee,LoanBankSaleComplete,EstimatePrice,GJJmoney,SYMoney,OldLoanMoney,OldRestMoney,TJMoney,BuildingArea,LoanContractDate,MortgageClearDate,LoanComplete,BankLoanDate,ReceiveLoanDate,SendToBankDate,VoucherToBankDate,CertificateDate,BankCompleteDate,SLDate,SHDate,FKDate,UpSLDate,UpSHDate,UpFKDate,EvaluateFeeDate,VouchFeeDate,InsuranceFeeDate,AgencyFeeDate,OutVouchFeeDate,EndDate,EstimReportBackDate,CompleteLoanDate,TJDate,IsNoEvaluateFee,IdBankReceipt,IdZhuanBen,IsNoAgencyFee,IdShouBen,IsLack,Receipt,Mortgage,Status,CompleteYear,Total_Floor,TJPercent,CreateLoanGiveInfo ");
            strSql.Append(" FROM t_Preliminary_SubInfo3 ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            return db.ExecuteDataSet(CommandType.Text, strSql.ToString());
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public static DataSet GetLoanCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(*) as count ");
            strSql.Append(" FROM t_Preliminary_SubInfo3 ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            return db.ExecuteDataSet(CommandType.Text, strSql.ToString());
        }

        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public static DataSet GetList(int PageIndex, int PageSize, String OrderField, string TableName, string StrWhere, string FieldList, string TableFieldList, bool DoCount)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            DbCommand dbCommand = db.GetStoredProcCommand("PagerMultiTable");
            db.AddInParameter(dbCommand, "PageIndex", DbType.Int32, PageIndex);
            db.AddInParameter(dbCommand, "PageSize", DbType.Int32, PageSize);
            db.AddInParameter(dbCommand, "OrderField", DbType.AnsiString, OrderField);
            db.AddInParameter(dbCommand, "TableName", DbType.AnsiString, TableName);
            db.AddInParameter(dbCommand, "StrWhere", DbType.AnsiString, StrWhere);
            db.AddInParameter(dbCommand, "FieldList", DbType.AnsiString, FieldList);
            db.AddInParameter(dbCommand, "TableFieldList", DbType.AnsiString, TableFieldList);
            db.AddInParameter(dbCommand, "DoCount", DbType.Boolean, DoCount);
            return db.ExecuteDataSet(dbCommand);
        }

        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("UP_GetRecordByPage");
            db.AddInParameter(dbCommand, "tblName", DbType.AnsiString, "t_Preliminary_SubInfo3");
            db.AddInParameter(dbCommand, "fldName", DbType.AnsiString, "ID");
            db.AddInParameter(dbCommand, "PageSize", DbType.Int32, PageSize);
            db.AddInParameter(dbCommand, "PageIndex", DbType.Int32, PageIndex);
            db.AddInParameter(dbCommand, "IsReCount", DbType.Boolean, 0);
            db.AddInParameter(dbCommand, "OrderType", DbType.Boolean, 0);
            db.AddInParameter(dbCommand, "strWhere", DbType.AnsiString, strWhere);
            return db.ExecuteDataSet(dbCommand);
        }*/

        /// <summary>
        /// 获得数据列表（比DataSet效率高，推荐使用）
        /// </summary>
        public static List<Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3> GetListArray(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,MainId,EmpCityId,EmpCompanyId,EmpDepartId,EmployeeId,OperateCompanyId,OperateDepartId,OperateUserId,ContractId,LoanCode,LoanInfo,LoanDealMode,ContractCode,EvaluateCorp,InsuranceCorp,LackInfo,ReceiveBank,LoanXfYear,LoanSxYear,LoanZyYear,SalerPhone,BuyerPhone,CustomerName,IDNum,GJJyear,SYYear,OrderPlace,SaleName,SaleIDCard,OldLoanBank,EmpCityName,EmpCompanyName,EmpDepartName,EmployeeName,EmpPhone,OperateCompanyName,OperateDepartName,OperateUserName,Address,Remark,SLRemark,SHRemark,FKRemark,SalePrice_T,EvaluateFee,InsuranceFee,AgencyFee,OutVouchFee,VouchFee,LoanXf,LoanSx,LoanZy,BankQueryFee,BankManageFee,LoanBankSaleComplete,EstimatePrice,GJJmoney,SYMoney,OldLoanMoney,OldRestMoney,TJMoney,BuildingArea,LoanContractDate,MortgageClearDate,LoanComplete,BankLoanDate,ReceiveLoanDate,SendToBankDate,VoucherToBankDate,CertificateDate,BankCompleteDate,SLDate,SHDate,FKDate,UpSLDate,UpSHDate,UpFKDate,EvaluateFeeDate,VouchFeeDate,InsuranceFeeDate,AgencyFeeDate,OutVouchFeeDate,EndDate,EstimReportBackDate,CompleteLoanDate,TJDate,IsNoEvaluateFee,IdBankReceipt,IdZhuanBen,IsNoAgencyFee,IdShouBen,IsLack,Receipt,Mortgage,Status,CompleteYear,Total_Floor,TJPercent,CreateLoanGiveInfo ");
            strSql.Append(" FROM t_Preliminary_SubInfo3 ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3> list = new List<Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3>();
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
                while (dataReader.Read())
                {
                    list.Add(ReaderBind(dataReader));
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return list;
        }

        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public static Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 Bind(IDataReader dataReader)
        {
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 model = new Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3();
            model.LoanCode = dataReader["LoanCode"].ToString();
            return model;
        }

        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public static Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 ReaderBind(IDataReader dataReader)
        {
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 model = new Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3();
            object ojb;
            ojb = dataReader["RecordId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RecordId = new Guid(ojb.ToString());
            }
            ojb = dataReader["MainId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MainId = new Guid(ojb.ToString());
            }
            ojb = dataReader["EmpCityId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EmpCityId = new Guid(ojb.ToString());
            }
            ojb = dataReader["EmpCompanyId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EmpCompanyId = new Guid(ojb.ToString());
            }
            ojb = dataReader["EmpDepartId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EmpDepartId = new Guid(ojb.ToString());
            }
            ojb = dataReader["EmployeeId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EmployeeId = new Guid(ojb.ToString());
            }
            ojb = dataReader["OperateCompanyId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OperateCompanyId = new Guid(ojb.ToString());
            }
            ojb = dataReader["OperateDepartId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OperateDepartId = new Guid(ojb.ToString());
            }
            ojb = dataReader["OperateUserId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OperateUserId = new Guid(ojb.ToString());
            }
            ojb = dataReader["ContractId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ContractId = new Guid(ojb.ToString());
            }
            model.LoanCode = dataReader["LoanCode"].ToString();
            model.LoanInfo = dataReader["LoanInfo"].ToString();
            model.LoanDealMode = dataReader["LoanDealMode"].ToString();
            model.ContractCode = dataReader["ContractCode"].ToString();
            model.EvaluateCorp = dataReader["EvaluateCorp"].ToString();
            model.InsuranceCorp = dataReader["InsuranceCorp"].ToString();
            model.LackInfo = dataReader["LackInfo"].ToString();
            model.ReceiveBank = dataReader["ReceiveBank"].ToString();
            model.LoanXfYear = dataReader["LoanXfYear"].ToString();
            model.LoanSxYear = dataReader["LoanSxYear"].ToString();
            model.LoanZyYear = dataReader["LoanZyYear"].ToString();
            model.SalerPhone = dataReader["SalerPhone"].ToString();
            model.BuyerPhone = dataReader["BuyerPhone"].ToString();
            model.CustomerName = dataReader["CustomerName"].ToString();
            model.IDNum = dataReader["IDNum"].ToString();
            model.GJJyear = dataReader["GJJyear"].ToString();
            model.SYYear = dataReader["SYYear"].ToString();
            model.OrderPlace = dataReader["OrderPlace"].ToString();
            model.SaleName = dataReader["SaleName"].ToString();
            model.SaleIDCard = dataReader["SaleIDCard"].ToString();
            model.OldLoanBank = dataReader["OldLoanBank"].ToString();
            model.EmpCityName = dataReader["EmpCityName"].ToString();
            model.EmpCompanyName = dataReader["EmpCompanyName"].ToString();
            model.EmpDepartName = dataReader["EmpDepartName"].ToString();
            model.EmployeeName = dataReader["EmployeeName"].ToString();
            model.EmpPhone = dataReader["EmpPhone"].ToString();
            model.OperateCompanyName = dataReader["OperateCompanyName"].ToString();
            model.OperateDepartName = dataReader["OperateDepartName"].ToString();
            model.OperateUserName = dataReader["OperateUserName"].ToString();
            model.Address = dataReader["Address"].ToString();
            model.Remark = dataReader["Remark"].ToString();
            model.SLRemark = dataReader["SLRemark"].ToString();
            model.SHRemark = dataReader["SHRemark"].ToString();
            model.FKRemark = dataReader["FKRemark"].ToString();
            ojb = dataReader["SalePrice_T"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SalePrice_T = (decimal)ojb;
            }
            ojb = dataReader["EvaluateFee"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EvaluateFee = (decimal)ojb;
            }
            ojb = dataReader["InsuranceFee"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.InsuranceFee = (decimal)ojb;
            }
            ojb = dataReader["AgencyFee"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.AgencyFee = (decimal)ojb;
            }
            ojb = dataReader["OutVouchFee"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OutVouchFee = (decimal)ojb;
            }
            ojb = dataReader["VouchFee"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.VouchFee = (decimal)ojb;
            }
            ojb = dataReader["LoanXf"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LoanXf = (decimal)ojb;
            }
            ojb = dataReader["LoanSx"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LoanSx = (decimal)ojb;
            }
            ojb = dataReader["LoanZy"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LoanZy = (decimal)ojb;
            }
            ojb = dataReader["BankQueryFee"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.BankQueryFee = (decimal)ojb;
            }
            ojb = dataReader["BankManageFee"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.BankManageFee = (decimal)ojb;
            }
            ojb = dataReader["LoanBankSaleComplete"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LoanBankSaleComplete = (decimal)ojb;
            }
            ojb = dataReader["EstimatePrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EstimatePrice = (decimal)ojb;
            }
            ojb = dataReader["GJJmoney"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.GJJmoney = (decimal)ojb;
            }
            ojb = dataReader["SYMoney"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SYMoney = (decimal)ojb;
            }
            ojb = dataReader["OldLoanMoney"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OldLoanMoney = (decimal)ojb;
            }
            ojb = dataReader["OldRestMoney"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OldRestMoney = (decimal)ojb;
            }
            ojb = dataReader["TJMoney"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.TJMoney = (decimal)ojb;
            }
            ojb = dataReader["BuildingArea"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.BuildingArea = (decimal)ojb;
            }
            ojb = dataReader["LoanContractDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LoanContractDate = (DateTime)ojb;
            }
            ojb = dataReader["MortgageClearDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MortgageClearDate = (DateTime)ojb;
            }
            ojb = dataReader["LoanComplete"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LoanComplete = (DateTime)ojb;
            }
            ojb = dataReader["BankLoanDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.BankLoanDate = (DateTime)ojb;
            }
            ojb = dataReader["ReceiveLoanDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ReceiveLoanDate = (DateTime)ojb;
            }
            ojb = dataReader["SendToBankDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SendToBankDate = (DateTime)ojb;
            }
            ojb = dataReader["VoucherToBankDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.VoucherToBankDate = (DateTime)ojb;
            }
            ojb = dataReader["CertificateDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CertificateDate = (DateTime)ojb;
            }
            ojb = dataReader["BankCompleteDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.BankCompleteDate = (DateTime)ojb;
            }
            ojb = dataReader["SLDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SLDate = (DateTime)ojb;
            }
            ojb = dataReader["SHDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SHDate = (DateTime)ojb;
            }
            ojb = dataReader["FKDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.FKDate = (DateTime)ojb;
            }
            ojb = dataReader["UpSLDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UpSLDate = (DateTime)ojb;
            }
            ojb = dataReader["UpSHDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UpSHDate = (DateTime)ojb;
            }
            ojb = dataReader["UpFKDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UpFKDate = (DateTime)ojb;
            }
            ojb = dataReader["EvaluateFeeDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EvaluateFeeDate = (DateTime)ojb;
            }
            ojb = dataReader["VouchFeeDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.VouchFeeDate = (DateTime)ojb;
            }
            ojb = dataReader["InsuranceFeeDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.InsuranceFeeDate = (DateTime)ojb;
            }
            ojb = dataReader["AgencyFeeDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.AgencyFeeDate = (DateTime)ojb;
            }
            ojb = dataReader["OutVouchFeeDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OutVouchFeeDate = (DateTime)ojb;
            }
            ojb = dataReader["EndDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EndDate = (DateTime)ojb;
            }
            ojb = dataReader["EstimReportBackDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EstimReportBackDate = (DateTime)ojb;
            }
            ojb = dataReader["CompleteLoanDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CompleteLoanDate = (DateTime)ojb;
            }
            ojb = dataReader["TJDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.TJDate = (DateTime)ojb;
            }
            ojb = dataReader["IsNoEvaluateFee"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IsNoEvaluateFee = (bool)ojb;
            }
            ojb = dataReader["IdBankReceipt"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IdBankReceipt = (bool)ojb;
            }
            ojb = dataReader["IdZhuanBen"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IdZhuanBen = (bool)ojb;
            }
            ojb = dataReader["IsNoAgencyFee"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IsNoAgencyFee = (bool)ojb;
            }
            ojb = dataReader["IdShouBen"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IdShouBen = (bool)ojb;
            }
            ojb = dataReader["IsLack"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IsLack = (bool)ojb;
            }
            ojb = dataReader["Receipt"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Receipt = (bool)ojb;
            }
            ojb = dataReader["Mortgage"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Mortgage = (bool)ojb;
            }
            ojb = dataReader["Status"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Status = (int)ojb;
            }
            ojb = dataReader["CompleteYear"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CompleteYear = (int)ojb;
            }
            ojb = dataReader["Total_Floor"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Total_Floor = (int)ojb;
            }
            ojb = dataReader["TJPercent"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.TJPercent = (int)ojb;
            }
            model.CreateLoanGiveInfo = dataReader["CreateLoanGiveInfo"].ToString();
            return model;
        }

        #endregion  成员方法
    }
}